<?php

/**
 * tblPrice filter form base class.
 *
 * @package    travis
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasetblPriceFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'hotel_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('HotelPrice'), 'add_empty' => true)),
      'room_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RoomPrice'), 'add_empty' => true)),
      'date'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'period'             => new sfWidgetFormFilterInput(),
      'type'               => new sfWidgetFormFilterInput(),
      'fit_price_usd'      => new sfWidgetFormFilterInput(),
      'fit_price_nis'      => new sfWidgetFormFilterInput(),
      'bar_price_usd'      => new sfWidgetFormFilterInput(),
      'bar_price_nis'      => new sfWidgetFormFilterInput(),
      'cascade_price_usd'  => new sfWidgetFormFilterInput(),
      'cascade_price_nis'  => new sfWidgetFormFilterInput(),
      'special_price_usd'  => new sfWidgetFormFilterInput(),
      'special_price_nis'  => new sfWidgetFormFilterInput(),
      'russian_market_usd' => new sfWidgetFormFilterInput(),
      'russian_market_nis' => new sfWidgetFormFilterInput(),
      'commission'         => new sfWidgetFormFilterInput(),
      'create_time'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'update_time'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'hotel_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('HotelPrice'), 'column' => 'id')),
      'room_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('RoomPrice'), 'column' => 'id')),
      'date'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'period'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'type'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fit_price_usd'      => new sfValidatorPass(array('required' => false)),
      'fit_price_nis'      => new sfValidatorPass(array('required' => false)),
      'bar_price_usd'      => new sfValidatorPass(array('required' => false)),
      'bar_price_nis'      => new sfValidatorPass(array('required' => false)),
      'cascade_price_usd'  => new sfValidatorPass(array('required' => false)),
      'cascade_price_nis'  => new sfValidatorPass(array('required' => false)),
      'special_price_usd'  => new sfValidatorPass(array('required' => false)),
      'special_price_nis'  => new sfValidatorPass(array('required' => false)),
      'russian_market_usd' => new sfValidatorPass(array('required' => false)),
      'russian_market_nis' => new sfValidatorPass(array('required' => false)),
      'commission'         => new sfValidatorPass(array('required' => false)),
      'create_time'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'update_time'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('tbl_price_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'tblPrice';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'hotel_id'           => 'ForeignKey',
      'room_id'            => 'ForeignKey',
      'date'               => 'Date',
      'period'             => 'Number',
      'type'               => 'Number',
      'fit_price_usd'      => 'Text',
      'fit_price_nis'      => 'Text',
      'bar_price_usd'      => 'Text',
      'bar_price_nis'      => 'Text',
      'cascade_price_usd'  => 'Text',
      'cascade_price_nis'  => 'Text',
      'special_price_usd'  => 'Text',
      'special_price_nis'  => 'Text',
      'russian_market_usd' => 'Text',
      'russian_market_nis' => 'Text',
      'commission'         => 'Text',
      'create_time'        => 'Date',
      'update_time'        => 'Date',
    );
  }
}
